<template>
  <div class="app-container">
    <el-row type="flex" class="row-bg">
      <el-col><div>会议号<el-input v-model="room_num" placeholder="请输入会议号" />
        <el-button type="primary" @click="enter_room">进入会议</el-button></div></el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { ticket } from '@/api/trtc'
export default {
  data() {
    return {
      room_num: '12345678',
      sdkInfo: {}
    }
  },
  computed: {
    ...mapGetters([
      'userId'
    ])
  },
  created() {
    this.get_ticket()
  },
  methods: {
    get_ticket(){
      //获取客户票据
      ticket({ userId: this.userId}).then(response => {
        const { data } = response
        this.sdkInfo = data
      });
    },
    enter_room() {
      // this.test(this.userId)
      // this.$router.push({ path: '/trtc/room', query: { userId: this.userId }})
      this.$router.push({ name: 'Room', query: {}, params: {sdkInfo:  this.sdkInfo, userId: this.userId, roomNum: this.room_num }})
    },
    randomUserId() {
				return Math.floor(Math.random() * 10000).toString();
		},
    test(msg) {
      this.$alert(msg, {
        confirmButtonText: '确定',
        callback: action => {
          this.$message({
            type: 'info',
            message: `action: ${action}`
          })
        }
      })
    }
  }
}
</script>
<style scoped>
